<{extend name="Public:public0" /}>

<{block name="title"}>框架数据传递 全局函数<{/block}>

<{block name="sidebar"}><{include file="Public:sidebar-vuecli" /}><{/block}>

<{block name="content"}>
<div class="content guide with-sidebar components-guide">
<h1>框架数据传递 全局函数</h1>	

<h2 id="func">
	<a href="#func" class="headerlink" title="func" data-scroll="">引入第三方全局函数</a>
</h2>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="com">//&nbsp;main.js</span></li><li class="L1"><span class="kwd">import</span><span class="pln">&nbsp;func&nbsp;</span><span class="kwd">from</span><span class="pln">&nbsp;</span><span class="str">'@js/func'</span></li><li class="L2"><span class="typ">Vue</span><span class="pun">.</span><span class="pln">prototype</span><span class="pun">.</span><span class="pln">$func&nbsp;</span><span class="pun">=</span><span class="pln">&nbsp;func</span></li><li class="L3"><span class="pln">&nbsp;</span></li><li class="L4"><span class="com">//&nbsp;func.js</span></li><li class="L5"><span class="kwd">export</span><span class="pln">&nbsp;</span><span class="kwd">default</span><span class="pln">&nbsp;</span><span class="pun">{</span></li><li class="L6"><span class="pln">&nbsp;&nbsp;</span><span class="kwd">dump</span><span class="pln">&nbsp;</span><span class="pun">(</span><span class="pln">str</span><span class="pun">)</span><span class="pln">&nbsp;</span><span class="pun">{</span></li><li class="L7"><span class="pln">&nbsp;&nbsp;&nbsp;&nbsp;alert</span><span class="pun">(</span><span class="pln">&nbsp;str&nbsp;</span><span class="pun">);</span></li><li class="L8"><span class="pln">&nbsp;&nbsp;</span><span class="pun">}</span></li><li class="L9"><span class="pun">}</span></li><li class="L0"><span class="pln">&nbsp;</span></li><li class="L1"><span class="com">//&nbsp;使用的框架中</span></li><li class="L2"><span class="kwd">this</span><span class="pun">.</span><span class="pln">$func</span><span class="pun">.</span><span class="kwd">dump</span><span class="pun">(</span><span class="pln">&nbsp;</span><span class="str">'ceshi'</span><span class="pln">&nbsp;</span><span class="pun">)</span></li></ol></code>






<br><br>


	
</div>
<{/block}>
